<template>
  <div class="user-profile">
    <h1>用户信息</h1>
    <el-card>
      <el-form label-width="120px">
        <el-form-item label="用户名">
          <el-input v-model="user.username" disabled />
        </el-form-item>
        <!-- 其他信息字段 -->
      </el-form>
    </el-card>
  </div>
</template>

<script setup>
import { computed, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { useUserStore } from '../stores/userStore';

const router = useRouter();
const userStore = useUserStore();

// 获取用户信息
const user = computed(() => userStore.user || {});

// 检查用户是否登录
onMounted(() => {
  if (!userStore.isLoggedIn) {
    ElMessage.warning('请先登录');
    router.push('/login');
  }
});
</script>